import 'package:cat_eye/base/base_view_model.dart';
import 'package:cat_eye/bean/find_class_if_coation_bean.dart';
import 'package:cat_eye/config/url_config.dart';
import 'package:flutter/material.dart';

/*
* @Package: view_model.find_view_model
* @ClassName: find_classifcoation_view_model
* @Author: szj
* @CreateDate: 8/2/21 3:38 PM
* TODO 发现-分类 ViewModel
*/
class FindClassificationViewModel extends BaseViewModel {
  List<FindClassIfCoationBean> itemList = [];

  @override
  String get httpUrl => UrlConfig.categoryUrl;

  @override
  void successJsonData(json) {
    if (itemList.length > 0) {
      itemList.clear();
    }
    var list = List.from(json);

    list.forEach((element) {
      var bean = FindClassIfCoationBean.fromJson(element);
      this.itemList.add(bean);
    });
  }
}
